package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import daos.PersistentObject;

@Entity
public class Casilla extends PersistentObject{
	
	@Column(length = 50)
	private String address;
	@Column(length = 50)
	private String apellido;

    @OneToMany(fetch = FetchType.EAGER)
    @Cascade({CascadeType.ALL, CascadeType.DELETE_ORPHAN})
    @JoinColumn(name = "id_casilla")
	private List<Inbox> mensajes;
    @Column(length = 50)
	private String nombre;
    @Column(length = 50)
	private String password;


	public Casilla(){

	}


	public Casilla(String address, String apellido, String nombre,
			String password) {
		super();
		this.address = address;
		this.apellido = apellido;
		this.nombre = nombre;
		this.password = password;
	}


	public String getAddress() {
		return address;
	}
	

}